import http from '../utils/request'

export function examListRequest() {
  return http({
    url: '/api/exams/student',
    method: 'get',
  })
}

// 获取考试详情函数已移至文件末尾


// 提交考试答案
export function submitExamAnswers(id, data) {
  return http({
    url: `/api/exams/${id}/submit`,
    method: 'post',
    data
  })
}

// 获取考试结果
export function getExamResult(examId) {
  return http({
    url: `/api/exams/${examId}/result`,
    method: 'get'
  })
}

// 提交考试答案
export function submitExam(examId, data) {
  return http({
    url: `/api/exams/${examId}/submit`,
    method: 'post',
    data
  })
}

// 保存考试草稿
export function saveExamDraft(examId, data) {
  return http({
    url: `/api/exams/${examId}/draft`,
    method: 'post',
    data
  })
}

// 获取考试详情
export function getExamDetail(examId) {
  return http({
    url: `/api/exams/${examId}`,
    method: 'get'
  })
}